//
//  ZHomeTableViewCell.swift
//  swift-weibo
//
//  Created by zero on 17/3/24.
//  Copyright © 2017年 zero. All rights reserved.
//

import UIKit

class ZHomeTableViewCell: UITableViewCell {

    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    //  布局
    private func setupUI(){
        
        
        
        originalView.backgroundColor = UIColor.white
        
        contentView.addSubview(originalView)
        
        //  约束
        
        originalView.snp.makeConstraints { (make) in
            
            make.top.leading.trailing.equalTo((contentView))
            
        }
        
        
        retweetView.backgroundColor = UIColor.lightGray
        
        contentView.addSubview(retweetView)
        
        retweetView.snp.makeConstraints { (make) in
            
            make.top.equalTo(originalView.snp.bottom)
            make.leading.trailing.equalTo(originalView)
        }
        
        
        buttomView.backgroundColor = UIColor.white
        
        contentView.addSubview(buttomView)
        //  约束
        buttomView.snp.makeConstraints { (make) in
            
            make.leading.trailing.bottom.equalTo(contentView)
         
            make.top.equalTo(retweetView.snp.bottom)
        }
    }
    
    
    //  添加原创博文
    let originalView = ZStatusOriginalView()
    
    //  添加转发博文
    let retweetView = ZStatusRetweetView()
    
    //  添加底部视图
    let buttomView = ZStatusBottomView()


    //  数据传输
    var homeModelViewModel:ZHomeModelViewModel?{
        
        didSet{
            
            originalView.homeModelViewModel = homeModelViewModel
            
            retweetView.homeModelViewModel = homeModelViewModel
            
        }
    }
    
    
    

}
